<?php
/**
 * callback controller
 * @package app-home_controller_member
 */
load_controller('/homebase');
/**
 * callback controller
 * @author pandajingjing
 * @package app-home_controller_member
 */
class member_callbackcontroller extends homebasecontroller{

	function doRequest(){
		$strAction=$this->getParam('action','url');
		$arrErrInfo=array();
		if('login'==$strAction or 'logout'==$strAction){
			$intUserID=$this->getParam('uid','url');
			$intCallTime=$this->getParam('t','url');
			$strSig=$this->getParam('as','url');
			$strUserName=$this->getParam('uname','url');
			load_lib('/bll/member/home');
			$clsMember=new bll_member_home();
			$mixResult=$clsMember->chkMemberCallBack($strSig,$intUserID,$strUserName,$intCallTime,$this->getTime());
			if(true===$mixResult){
				if('login'==$strAction){
					$arrUserInfo=array(
							'USERID'=>$intUserID,
							'USERNAME'=>$strUserName
					);
					$this->setCookie('authcode',$clsMember->encryptLoginInfo($arrUserInfo),31536000);
				}elseif('logout'==$strAction){
					$this->setCookie('authcode','',-1);
				}
			}else{
				$arrErrInfo[]=$mixResult;
			}
		}
		$this->setData('arrErrInfo',$arrErrInfo);
		$this->setData('jsonErrInfo',json_encode($arrErrInfo));
		return '/member/callback';
	}

	/**
	 * 获取访问该控制器的路径
	 */
	static function getURL($p_strAction='',$p_arrParam=array(),$p_bolSecure=false,$p_strPre=''){
		return parent::getURL('/member/callback',$p_strAction,$p_arrParam);
	}
}